package com.mall.admin.service;

import com.mall.commons.utils.R;
import com.mall.domain.SmsHomeAdvertise;
import com.mall.interface1.api.SmsHomeAdvertiseServiceApi;
import com.mall.vo.SmsHomePageBeanVo;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Component;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.List;


@Component
public class SmsHomeAdvertiseService {


    @DubboReference
    SmsHomeAdvertiseServiceApi smsHomeAdvertiseServiceApi;

    public R findByPage(String endTime, String name, Integer pageNum, Integer pageSize, Integer type) {
        return R.success(smsHomeAdvertiseServiceApi.findByPage(endTime,name,pageNum,pageSize,type));

    }


    public R addCreate(SmsHomeAdvertise advertise) {
            smsHomeAdvertiseServiceApi.addCreate(advertise);

        return R.success("添加成功");
    }

    public R delete(List<Long> ids) {
        for (Long id : ids) {
            smsHomeAdvertiseServiceApi.delete(id);
        }
        return R.success("删除成功");
    }

    public R updateStatus(Long id, Integer status) {
        smsHomeAdvertiseServiceApi.updateStatus(id, status);
        return R.success("修改成功");
    }

    public R updateAdvertise(SmsHomeAdvertise advertise, Long id) {
        smsHomeAdvertiseServiceApi.updateAdvertise(advertise, id);
        return R.success("修改成功");
    }

    public SmsHomeAdvertise findById(Long id) {
    return smsHomeAdvertiseServiceApi.findById(id);
    }
}
